
var cur_video = null;
var video = new Object();

function closeVideo(){

    if (cur_video != null){
        video[cur_video].pause();
        $("#video_block_background").hide();
        $("#video_frame").hide();
        $(".video_block_wrapper").closest(".video_block_wrapper").hide();
    }
}

jQuery(document).ready(function ($) {

    // Page prep
    video['_video_1'] = _V_("block_video_1");
    video['_video_2'] = _V_("block_video_2");
    video['_video_3'] = _V_("block_video_3");
    video['_video_4'] = _V_("block_video_4");
    video['_video_5'] = _V_("block_video_5");
    video['_video_6'] = _V_("block_video_6");

    $("a#video_close_button").click(function () {
        closeVideo();
    });

    // show video
    $("li.on a.menu_video").click(function () {
        var video_id = $(this).closest(".floor_video").find(".video_block").attr('id');
        cur_video = video_id;
        $("#video_block_background").fadeIn(250,
            function () {
                //$("#wrapper" + cur_video).closest(".video_block_wrapper").show();
            });
        $("#video_frame").fadeIn(250);

        $("#wrapper" + cur_video).closest(".video_block_wrapper").fadeIn(2500,
            function () {
                video[video_id].currentTime(0);
                video[video_id].play();
            });
        return false;
    });
});